set(CPP20_SOURCES
    concepts.cpp
    ranges.cpp
    coroutines.cpp
    modules.cpp
    format.cpp
    span.cpp
    three_way_comparison.cpp
    designated_initializers.cpp
    consteval_constinit.cpp
    constexpr_containers.cpp
    jthread.cpp
    features.cpp
)

# 创建库（供其他项目使用）
add_library(cpp20_features_lib ${CPP20_SOURCES})
target_compile_features(cpp20_features_lib PUBLIC cxx_std_20)

# 链接pthread库（coroutines.cpp使用了std::thread）
find_package(Threads REQUIRED)
target_link_libraries(cpp20_features_lib PUBLIC Threads::Threads)

# 创建可执行文件
add_executable(cpp20_features main.cpp)
target_compile_features(cpp20_features PUBLIC cxx_std_20)
target_link_libraries(cpp20_features cpp20_features_lib Threads::Threads)

# 为了向后兼容，创建别名
add_library(cpp20_features ALIAS cpp20_features_lib) 